/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jsf.bean.client;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import model.client.PaymentTypeBeans;
import model.client.ReligionBeans;

/**
 *
 * @author Administrator
 */
@ManagedBean
@RequestScoped
public class PaymentBean_c {
    private int payment_Type_Id;
    private boolean payment_Type_Status;
    private String payment_Type_Name;

    public int getPayment_Type_Id() {
        return payment_Type_Id;
    }

    public void setPayment_Type_Id(int payment_Type_Id) {
        this.payment_Type_Id = payment_Type_Id;
    }

    public String getPayment_Type_Name() {
        return payment_Type_Name;
    }

    public void setPayment_Type_Name(String payment_Type_Name) {
        this.payment_Type_Name = payment_Type_Name;
    }

    public boolean isPayment_Type_Status() {
        return payment_Type_Status;
    }

    public void setPayment_Type_Status(boolean payment_Type_Status) {
        this.payment_Type_Status = payment_Type_Status;
    }
    
    
    /**
     * Creates a new instance of PaymentBean_c
     */
    public PaymentBean_c() {
    }
    
    Connection conn;
        
        public List<PaymentTypeBeans> loadPayment()throws SQLException, ClassNotFoundException{
        conn = JDBCUtil.MyConn.getConnection();
        
        List<PaymentTypeBeans> list = new ArrayList<PaymentTypeBeans>();
        
        String sql ="select * from Payment_Types";
        
        PreparedStatement pst = conn.prepareStatement(sql);
        ResultSet rs = pst.executeQuery();
        while(rs.next()){
            PaymentTypeBeans p = new PaymentTypeBeans();
            p.setPayment_Type_Id(rs.getInt("Payment_Type_Id"));
            p.setPayment_Type_Name(rs.getNString("Payment_Type_Name"));
            list.add(p);
        }
        return list;
    }
}
